#pragma once

#ifndef RANDOMDECISION_H
#define RANDOMDECISION_H

#include <cstdlib>
#include "Decision.h"

template<typename T>
class RandomDecision : public Decision<T>
{
public:
	RandomDecision(DecisionTreeNode<T>* trueNode, DecisionTreeNode<T>* falseNode)
		: Decision<T>(trueNode, falseNode) { }
	virtual ~RandomDecision() { }
	DecisionTreeNode<T>* getBranch(T* owner);
};

#endif

template<typename T>
DecisionTreeNode<T>* RandomDecision<T>::getBranch(T* owner)
{
	bool choice = rand() % 2 == 0 ? true : false;
	if(choice)
		return trueNode;
	else
		return falseNode;
}